package com.qf.ks.controller;

import com.qf.ks.dto.R;
import com.qf.ks.service.CategoriesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/category")
public class CategoriesController {
    private CategoriesService categoriesService;
    @Autowired
    public CategoriesController(CategoriesService categoriesService) {
        this.categoriesService = categoriesService;
    }

    @PostMapping("/newcategory/{categoryName}")
    public R AddCategories(@PathVariable("categoryName") String categoryname){
        categoriesService.AddCategories(categoryname);
        return R.setOk(null);
    }
}
